#include "DataModel.h"
#include "DlgPickDateTime.h"
#include "DlgTimeSlice.h"
#include "scImpl.h"

#define FCT "DlgTimeSlice::DlgTimeSlice"
DlgTimeSlice::DlgTimeSlice(QWidget *parent) :
	QDialog(parent)
{
	ctrc(Trc::WORK,APP,FCT)<<"start"<<endl;
	ui.setupUi(this);
	ui.date->setDateTime(DataModel::get()->getDeadlineQ());
	connect(ui.butPick, SIGNAL(clicked()), this, SLOT(butPickSl()));
}

#undef FCT
#define FCT "DlgTimeSlice::~DlgTimeSlice"
DlgTimeSlice::~DlgTimeSlice()
{
}

#undef FCT
#define FCT "DlgTimeSlice::butPickSl"
void DlgTimeSlice::butPickSl()
{
	DlgPickDateTime dlg(ui.date->dateTime(), this);
	if(dlg.exec()==QDialog::Rejected)
	{
		ctrc(Trc::WORK,APP,FCT)<<"dialog canceled"<<endl;
		return;
	}
	ui.date->setDateTime(dlg.getResult());
}

